AC_DEFUN([AX_CHECK_AND_APPEND_FLAG],
[AC_PREREQ([2.59])dnl for _AC_LANG_PREFIX
 AX_CHECK_COMPILE_FLAG([$1],
    [AX_APPEND_FLAG([$1], [m4_default([$2], [_AC_LANG_PREFIX[]FLAGS])])])
])dnl AX_CHECK_AND_APPEND_FLAG
